const Mock = require('mockjs'); // 假数据

module.exports = function (app) {
    const prefix = '/api/user/';
    // 生成用户
    const userList = Mock.mock({
        'list|40': [{
            'userId': '@increment(100)',
            'userName': '@cname'
        }]
    });
    // API::所有用户
    app.get(prefix + 'pullusers', (req, res) => {
        const code = 200;
        const msg = '';
        const data = userList;
        const time = +(new Date);
        const result = {code, data, msg, time};
        return res.end(JSON.stringify(result));
    });
};
